<?xml version="1.0" encoding="UTF-8"?>
<!--
  Copyright © 2017-2024 Petr Panteleyev <petr-panteleyev@yandex.ru>
  SPDX-License-Identifier: BSD-2-Clause
  -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.panteleyev.money</groupId>
        <artifactId>money-manager-parent</artifactId>
        <version>${revision}</version>
    </parent>

    <artifactId>money-manager-desktop</artifactId>
    <packaging>jar</packaging>
    <name>Desktop</name>

    <profiles>
        <profile>
            <id>win</id>
            <activation>
                <os>
                    <family>windows</family>
                </os>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.panteleyev</groupId>
                        <artifactId>jpackage-maven-plugin</artifactId>

                        <configuration>
                            <icon>icons/icon.ico</icon>
                            <winMenu>true</winMenu>
                            <winDirChooser>true</winDirChooser>
                            <winUpgradeUuid>38dac4b6-91d2-4ca8-aacb-2e0cfd54127a</winUpgradeUuid>
                            <winMenuGroup>panteleyev.org</winMenuGroup>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>mac</id>
            <activation>
                <os>
                    <family>mac</family>
                </os>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.panteleyev</groupId>
                        <artifactId>jpackage-maven-plugin</artifactId>

                        <configuration>
                            <icon>icons/icon.icns</icon>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>linux</id>
            <activation>
                <os>
                    <name>linux</name>
                </os>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.panteleyev</groupId>
                        <artifactId>jpackage-maven-plugin</artifactId>

                        <configuration>
                            <type>APP_IMAGE</type>
                            <icon>icons/icon48.png</icon>
                            <javaOptions>
                                <option>-Dsun.java2d.opengl=true</option>
                            </javaOptions>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <properties>
        <appModule>org.panteleyev.money</appModule>
        <appMainClass>org.panteleyev.money.MoneyApplication</appMainClass>
    </properties>

    <dependencies>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>money-manager-model</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>money-manager-ofx</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>money-manager-moex</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.panteleyev</groupId>
            <artifactId>java-fx-helpers</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.openjfx</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.panteleyev</groupId>
            <artifactId>freedesktop</artifactId>
        </dependency>
        <dependency>
            <groupId>org.controlsfx</groupId>
            <artifactId>controlsfx</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.openjfx</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jsoup</groupId>
            <artifactId>jsoup</artifactId>
        </dependency>
        <!-- JavaFX Start -->
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-base</artifactId>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-controls</artifactId>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-media</artifactId>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-graphics</artifactId>
        </dependency>
        <!-- JavaFX End -->
        <dependency>
            <groupId>org.freemarker</groupId>
            <artifactId>freemarker</artifactId>
        </dependency>
        <dependency>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
        </dependency>
        <!-- Test -->
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-swing</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>postgresql</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>${project.basedir}/src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <outputDirectory>target/jmods</outputDirectory>
                    <archive>
                        <manifestEntries>
                            <Main-Class>${appMainClass}</Main-Class>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <includeScope>runtime</includeScope>
                            <outputDirectory>target/jmods</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <argLine>
                        --add-opens javafx.graphics/javafx.scene=org.controlsfx.controls
                        --add-exports javafx.base/com.sun.javafx.event=org.controlsfx.controls
                        --add-exports javafx.base/com.sun.javafx.logging=ALL-UNNAMED
                        --add-exports javafx.graphics/com.sun.javafx.application=ALL-UNNAMED
                        --add-exports javafx.graphics/com.sun.javafx.embed=ALL-UNNAMED
                    </argLine>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.panteleyev</groupId>
                <artifactId>jpackage-maven-plugin</artifactId>
                <configuration>
                    <name>Money Manager</name>
                    <appVersion>${project.version}</appVersion>
                    <vendor>panteleyev.org</vendor>
                    <runtimeImage>${java.home}</runtimeImage>
                    <module>${appModule}/${appMainClass}</module>
                    <modulePaths>
                        <modulePath>target/jmods</modulePath>
                    </modulePaths>
                    <destination>target/dist</destination>
                    <javaOptions>
                        <option>-Xms128m</option>
                        <option>--add-exports</option>
                        <option>javafx.base/com.sun.javafx.event=org.controlsfx.controls</option>
                    </javaOptions>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.openjfx</groupId>
                <artifactId>javafx-maven-plugin</artifactId>
                <configuration>
                    <mainClass>${appModule}/${appMainClass}</mainClass>
                </configuration>
                <executions>
                    <execution>
                        <id>default-cli</id>
                        <configuration>
                            <options>
                                <option>-Xms128m</option>
                                <option>--add-exports</option>
                                <option>javafx.base/com.sun.javafx.event=org.controlsfx.controls</option>
                                <option>-Dprofile=${profile}</option>
                                <option>-Dnoauto=${noauto}</option>
                            </options>
                        </configuration>
                    </execution>
                    <execution>
                        <id>debug</id>
                        <configuration>
                            <options>
                                <option>-Xms128m</option>
                                <option>--add-exports</option>
                                <option>javafx.base/com.sun.javafx.event=org.controlsfx.controls</option>
                                <option>-agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address}</option>
                                <option>-Dprofile=${profile}</option>
                                <option>-Dnoauto=${noauto}</option>
                            </options>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
